package com.xyazm.order.mq.producer;


import com.xyazm.common.enums.RocketMqTopicEnum;
import com.xyazm.order.mq.config.RocketMQProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.TransactionMQProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 支付订单成功生产者组件
 * @author xuyou
 * 2022-12-10 20:38
*/
@Slf4j
@Component
public class PaidOrderSuccessProducer extends AbstractTransactionProducer{

    @Autowired
    public PaidOrderSuccessProducer(RocketMQProperties rocketMQProperties) {
        producer = new TransactionMQProducer(RocketMqTopicEnum.PAID_ORDER_SUCCESS.getProducerGroup());
        producer.setNamesrvAddr(rocketMQProperties.getNameServer());
        start();
    }

}
